package classfile

/*
*
ConstantValue_attribute {
u2 attribute_name_index;
u4 attribute_length;  ConstantValue_attribute 结构的 attribute_length 项的值固定为 2
u2 constantvalue_index;
}
*/
type ConstantValueAttr struct {
	AttrStruct
	constantValueIndex uint16
	constantValue      Constant
}

func (self *ConstantValueAttr) readAttr(cp ConstantPool) AttributeInfo {
	self.constantValueIndex = self.attributeData.ReadUInt16()
	self.constantValue = cp.GetConstant(self.constantValueIndex)
	return self
}

func (self ConstantValueAttr) GetConstantValueIndex() uint16 {
	return self.constantValueIndex
}
